<html>
  <header>
    <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
    <title>Typegle test</title>
<style>
*{margin:0}
body { margin: 10px;}
div{ margin: 0;}
h3.title { font-size: medium;margin-bottom: 3px;}
.item { max-width: 546px; margin-top: 23px;}
.summary {margin: .2em 0 0;}
.url {color :#0E774A;}
.url a {
text-decoration: none;
color: #4272DB;
}
#result{
padding-left: 16px;
border-left: 1px solid #D3E1F9;
clear: both;
color: black;
display: block;
font-family: arial, sans-serif;
font-size: 13px;
margin-bottom: 0px;
margin-left: 159px;
margin-top: 0px;
max-width: 1144px;
min-width: 780px;
padding-top: 17px;
}


</style>
    
  </header>
<body>
<script type="text/javascript" src="FlashHelper.js"></script>
<!-- <script type="text/javascript" src="ObjTree.js"></script> -->
<!-- <script type="text/javascript" src="saXMLUtils.js"></script> -->
<script type="text/javascript" src="jkl-dumper.js"></script>
<script type="text/javascript">

FlashHelper.onload = startApp;

var dumper = new JKL.Dumper();

function startApp(fs) {
    if (!fs) { alert("Flash not loaded"); return; }
    fs.Debug();
}


function loadXMLString(xml_str){
   if (window.DOMParser)
   {
      var parser=new DOMParser();
      var xmlDoc=parser.parseFromString(xml_str,"text/xml");
   }else{
      var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
      xmlDoc.async="false";
      xmlDoc.loadXML(xml_str); 
   }
   return xmlDoc;
}

function displayResponse() {
   var xml_text = FlashHelper.getFlash().GetVariable("retText");
   var r = loadXMLString(xml_text);
   results = r.getElementsByTagName("Result");
   var resHTML = "";
   var title     = "";
   var summary   = "";
   var org_uri   = "";
   var click_uri = "";
   var cache_uri = "";
   //alert(results.length);
   for(var i = 0; i < results.length; i++){
      var items = results[i].childNodes;
      for(var j = 0; j < items.length; j++){
         if(! items[j].hasChildNodes()) { continue; }
         switch(items[j].nodeName){
            case "Title"            : title      = items[j].childNodes[0].nodeValue; break;
            case "Summary"          : summary    = items[j].childNodes[0].nodeValue; break;
            case "Url"              : org_uri    = items[j].childNodes[0].nodeValue; break;
            case "ClickUrl"         : click_uri  = items[j].childNodes[0].nodeValue; break;
            default: null;
         }
         if(items[j].nodeName == "Cache"){
           if(window.navigator.userAgent.toLowerCase().indexOf("msie") > -1){
              cache_uri = items[j].childNodes[0].firstChild.nodeValue;
           }else{
              cache_uri = items[j].childNodes[1].firstChild.nodeValue;
           }
         }
      }
      
      resHTML += '<div class="item">'+
                 '<h3 class="title"><a href="'+click_uri+'">'+title+'</a></h3>'+
                 '<div class="summary">' + summary +'</div>'+
                 '<span class="url">' + org_uri +' - '+
                 '<a href="'+ cache_uri +'">キャッシュ</a>'+
                 '</span></div>';
      // resHTML += '<h3>'+title+'</h3>';
   }
   $("result").innerHTML = resHTML;
}

function makeCall() {
   var keyword = $("omnibox").value;
   var url = "http://search.yahooapis.jp/WebSearchService/V2/webSearch?appid=sino_200x&query="+ encodeURIComponent(keyword);
   var method = "GET";
   var body = null;
   var contentType = null;
   var fs = FlashHelper.getFlash();
   fs.XmlHttp(url, "displayResponse", method, body, contentType);
   $("requesturi").innerHTML = url;
}

</script>
たいぷぐる：
<input type="text" style="width: 400px;" id="omnibox" onKeyUp="makeCall(); return false;"> 
<input type="button" value="Search!" onClick="makeCall(); return false;"/>
<div id="requesturi" style="display:none"></div>
<div id="result"></div>
<script type="text/javascript"> 
FlashHelper.height = 0;
FlashHelper.width = 0;
FlashHelper.writeFlash();
</script> 
</body>
</html>
